<?php

class Materials_Model_Material_Observer_Catalogue_CategoryRelation extends Workset_Model_Observer_Abstract {

	function beforeLinkObject(Workset_Model_Subject_Interface $material, $category = null)
	{
		if ($category instanceof Catalogue_Model_Category) {
			$material->getStorage()->linkCatalogueCategory($material, $category);
			$category->setIsModified(true);
		}
	}

	function beforeUnlinkObject(Workset_Model_Subject_Interface $material, $category = null) {
		if ($category instanceof Catalogue_Model_Category) {
			$material->getStorage()->unlinkCatalogueCategory($material, $category);
			$category->setIsModified(true);
		}
	}
	
}